package com.grad.webstudy.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.grad.webstudy.model.User;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * @Author: zjf
 * @Date: 2020/1/18 15:22
 * @Description:
 */
public class UserVo implements Serializable {


    private Integer id;

    private String username;

    private String password;

    private String phone;

    private String imagePath;

    private Integer enableComment;

    private Integer enableLogin;

    private String duration;

    private String roleIds;

    @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date registerTime;

    private List<String> roles;

    public UserVo() {
    }

    public UserVo(Builder builder) {
        this.id = builder.id;
        this.username = builder.username;
        this.password = builder.password;
        this.phone = builder.phone;
        this.imagePath = builder.imagePath;
        this.enableComment = builder.enableComment;
        this.enableLogin = builder.enableLogin;
        this.duration = builder.duration;
        this.roleIds = builder.roleIds;
        this.registerTime = builder.registerTime;
        this.roles = builder.roles;
    }

    @Override
    public String toString() {
        return "UserVo{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", phone='" + phone + '\'' +
                ", imagePath='" + imagePath + '\'' +
                ", enableComment=" + enableComment +
                ", enableLogin=" + enableLogin +
                ", duration='" + duration + '\'' +
                ", roleIds='" + roleIds + '\'' +
                ", registerTime=" + registerTime +
                ", roles=" + roles +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public Integer getEnableComment() {
        return enableComment;
    }

    public void setEnableComment(Integer enableComment) {
        this.enableComment = enableComment;
    }

    public Integer getEnableLogin() {
        return enableLogin;
    }

    public void setEnableLogin(Integer enableLogin) {
        this.enableLogin = enableLogin;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(String roleIds) {
        this.roleIds = roleIds;
    }

    public Date getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }

    public List<String> getRoles() {
        return roles;
    }

    public void setRoles(List<String> roles) {
        this.roles = roles;
    }


    public static class Builder{
        private Integer id;

        private String username;

        private String password;

        private String phone;

        private String imagePath;

        private Integer enableComment;

        private Integer enableLogin;

        private String duration;

        private String roleIds;

        @JsonFormat( pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date registerTime;

        private List<String> roles;


        public Builder setId(Integer id) {
            this.id = id;
            return this;
        }

        public Builder setUsername(String username) {
            this.username = username;
            return this;
        }

        public Builder setPassword(String password) {
            this.password = password;
            return this;
        }

        public Builder setPhone(String phone) {
            this.phone = phone;
            return this;
        }

        public Builder setImagePath(String imagePath) {
            this.imagePath = imagePath;
            return this;
        }

        public Builder setEnableComment(Integer enableComment) {
            this.enableComment = enableComment;
            return this;
        }

        public Builder setEnableLogin(Integer enableLogin) {
            this.enableLogin = enableLogin;
            return this;
        }

        public Builder setDuration(String duration) {
            this.duration = duration;
            return this;
        }

        public Builder setRoleIds(String roleIds) {
            this.roleIds = roleIds;
            return this;
        }

        public Builder setRegisterTime(Date registerTime) {
            this.registerTime = registerTime;
            return this;
        }

        public Builder setRoles(List<String> roles) {
            this.roles = roles;
            return this;
        }

        public UserVo build(){
            return new UserVo(this);
        }
    }
}
